﻿namespace DataContextDemo
{
    public class WindowModel
    {
        //注意要使用属性而不是字段，否则绑定补上，eg：public TextBoxModel TextBoxModel = new TextBoxModel(); 就会绑定不上
        public string Title { get; set; } = "DataContextDemo";
        public TextBoxModel TextBoxModel { get; set; } = new TextBoxModel();
        public ButtonModel ButtonModel { get; set; } = new ButtonModel();
    }

    public class TextBoxModel
    {
        public string Text { get; set; } = "Hello World";
    }

    public class ButtonModel
    {
        public int Width { get; set; } = 300;
        public int Height { get; set; } = 50;
    }
}
